<template>
    <div>
        <h2>添加</h2>
        <table>
            <tr>
                <td>会员用户名</td>
                <td>
                    <input type="text" placeholder="请输入用户名" v-model="info.Name">
                </td>
            </tr>
            <tr>
                <td>会员密码</td>
                <td>
                    <input type="password" placeholder="请输入密码" v-model="info.Pwd">
                </td>
            </tr>
            <tr>
                <td>会员手机号</td>
                <td>
                    <input type="text" placeholder="请输入手机号" v-model="info.Phone">
                </td>
            </tr>
            <tr>
                <td>会员性别</td>
                <td>
                    <input type="text" placeholder="请输入用户名" v-model="info.Sex">
                </td>
            </tr>
            <tr>
                <td>
                    <input type="button" value="添加" @click="add">
                </td>
            </tr>
        </table>
    </div>
</template>

<script setup lang="ts">
import{ref,reactive,onMounted}from 'vue';
import axios from 'axios';
import { useRouter } from 'vue-router';

const info=ref({
    Name:'',
    Pwd:'',
    Phone:'',
    Sex:'',
    State:true
})

const add=()=>{
    axios.post('https://localhost:7064/api/Member/AddMember',{
        Name:info.value.Name,
        Pwd:info.value.Name,
        Phone:info.value.Phone,
        Sex:info.value.Sex,
        State:info.value.State
    })
    .then(res=>{
        if(res.data>0){
            alert("添加成功");
        }
        else{
            alert("添加失败");
            return;
        }
    })
    .catch(err=>{
        console.log(err);
    })
}
</script>

<style scoped>

</style>